server actionの通信のやり取りの中身を見てみる
server actionの通信のやり取りの中身を見てみる
試したmiyamonz.icon
ちゃんと動いた
create next app
適当にインメモリに保存するserver action書く
ページとコンポーネント用意
page as RSC,
await getDataする
client component
addData (server mutation)
revalidate (server mutation)
普通に機能した
黒魔術すぎるのでnetworkみて何が起きてるのか確認した
RSCのstreamのレスポンスなどを見て、まあ確かにという感じって感じ
ストリーム
数字:記号json
数字
ストリーム内での識別子?
記号
HL
hot reloadだろうか?
pathとそれの解釈するための方法
code:json
I
わからん
code:json
記号なし
多分コンポーネント
code:json
8:["$","main",null,{"className":"flex flex-col items-center justify-between p-24","children":["hello example from RSC",["$","$L9",null,{"items":{"hoge":"$D2023-06-24T07:23:04.385Z"},{"hoge":"$D2023-06-24T07:23:11.056Z"},{"hoge":"$D2023-06-24T07:23:24.341Z"},{"hoge":"$D2023-06-24T07:23:30.272Z"},{"hoge":"$D2023-06-24T07:23:36.987Z"},{"hoge":"$D2023-06-24T07:23:43.094Z"},{"hoge":"$D2023-06-24T07:24:22.653Z"}}]]}] 4:[["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_0ec1f4","children":["$","$L6",null,{"parallelRouterKey":"children","segmentPath":"children","error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":"$","$L7",null,{},"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$","$L6",null,{"parallelRouterKey":"children","segmentPath":"children","example","children","error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":"$","$L7",null,{},"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":"$L8",null,"segment":"__PAGE__"},"styles":[]}],"segment":"example"},"styles":[]}]}]}],null] 5:"$","meta","0",{"charSet":"utf-8"}],"$","title","1",{"children":"Create Next App"},"$","meta","2",{"name":"description","content":"Generated by create next app"},"$","meta","3",{"name":"viewport","content":"width=device-width, initial-scale=1"},["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"} やばすぎる
というかon-demand revalidationをserver action経由で叩くと、そのrevalidationの結果の差分のRSCが返ってくるという挙動、ぜんぜんドキュメントにも書いてないし分からんのでは